package se.webbzon.boltzmann.login;

public abstract class LoginAccess {
	
	// The domain and username of this login access
	private final String domain, username;
	
	// The hashword and session id of the login access
	private byte[] hashword, sessionId;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public LoginAccess(String domain, String username, byte[] hashword) {
		this.domain = domain;
		this.username = username;
		this.hashword = hashword;
		this.sessionId = null;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Refreshes the login access. By refreshing the login access
	 * the session id may change depending on the underlying server
	 * implementation. **/
	public abstract void refresh() throws AccessException;
	
	/** Returns the domain of this login access. **/
	public String getDomain() {
		return domain;
	}
	
	/** Returns the username of this login access. **/
	public String getUsername() {
		return username;
	}
	
	/** Returns the hashword of this login access. **/
	public byte[] getHashword() {
		return hashword;
	}
	
	/** Returns the session id of this login access. **/
	public byte[] getSessionId() {
		return sessionId;
	}
	
	/*============================================================
	Protected Methods
	============================================================*/
	
	/** Sets the session id of this login access. **/
	public void setSessionId(byte[] sessionId) {
		this.sessionId = sessionId;
	}

}
